/**通过属性文件配置数据的方式之二：批量向数据类中注入（通过@PropertySource和@ConfigurationProperties）
 *要求：属性文件中的属性名和数据类中的属性名要完全一致，数据类中必须配setter
 *               properties                yaml
 *
 * 基本数据           ok                     ok ,要配YamlFactory
 * 集合数据           ok                     ok，要配YamlFactory，支持多行表达
 */
package com.example.demospringbootbean;


import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

import java.util.*;

@Component
@ConfigurationProperties(prefix = "my")
//@PropertySource(value="classpath:collection.properties")
@PropertySource(value="classpath:collection.yml",factory = YamlPropertySourceFactory.class)
public class ClassCollection2 {
    List<String> addressList;
    Set  addressSet;
    Map<String,String>  addressMap;

    // a setter method to List
    public void setAddressList(List addressList) {
        this.addressList = addressList;
    }

   // a setter method to  Set
    public void setAddressSet(Set addressSet) {
        this.addressSet = addressSet;
    }

    // a setter method to Map
    public void setAddressMap(Map<String,String> addressMap) {
        this.addressMap = addressMap;
    }

}
